<div ng-controller="Common.layout" id="wrapper">

    <loading ng-if="loadingStatus"></loading>

    <div ng-if="!loadingStatus">

        <header></header>

        <!-- <div id="page-wrapper" style="min-height: 561px;margin: 0 0 0 180px;padding: 0px;"> -->
        <div id="page-wrapper" style="min-height: 561px;margin: 0;padding: 0px;">
            <div ui-view></div>
        </div>
    </div>

    <!-- 修改密码 -->
    <form name="mySettingsForm">
        <div class="modal fade" id="ChangePassword" tabindex="-1" role="dialog" aria-labelledby="ChangePasswordLabel" aria-hidden="true">
            <div class="modal-dialog">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                        <h4 class="modal-title" id="ChangePasswordLabel">修改密码</h4><small style="color:red;">如忘记密码，请联系系统管理员！</small>
                    </div>
                    <div class="modal-body">
                        <div class="form-group form-md-line-input form-md-floating-label">
                            <label>原密码：</label>
                            <input type="password" name="currentPassword" class="form-control" ng-model="modifyPwd.currentPassword" required maxlength="">
                            <!-- <span class="help-block">忘记密码？
                                <a href="">点这里</a>
                            </span> -->
                        </div>
                        <div style="color:red" ng-show="mySettingsForm.currentPassword.$dirty && mySettingsForm.currentPassword.$invalid">
                            <p style="margin: 0px;" ng-show="mySettingsForm.currentPassword.$error.required">- 原密码是必须的。</p>
                        </div>
                        <div class="form-group form-md-line-input form-md-floating-label no-hint">
                            <label>新密码：</label>
                            <input type="password" name="NewPassword" class="form-control" ng-model="modifyPwd.newPassword" required maxlength="32" ng-minlength="6"
                                ng-pattern="/^(?=.*[0-9])(?=.*[a-zA-Z])(.{2,})$/">
                        </div>
                        <div style="color:red" ng-show="mySettingsForm.NewPassword.$dirty && mySettingsForm.NewPassword.$invalid">
                            <p style="margin: 0px;" ng-show="mySettingsForm.NewPassword.$error.required">-
                                <span>新密码是必须的。</p>
                            <p style="margin: 0px;" ng-show="mySettingsForm.NewPassword.$error.minlength || mySettingsForm.NewPassword.$error.maxlength">- 新密码必须大于6位，且小于32位。</p>
                            <p style="margin: 0px;" ng-show="mySettingsForm.NewPassword.$error.pattern">- 新密码必须包含
                                <b>数字</b>和
                                <b>英文</b>。</p>
                        </div>
                        <div class="form-group form-md-line-input form-md-floating-label no-hint">
                            <label>确认新密码：</label>
                            <input type="password" name="confirmNewPassword" class="form-control" ng-model="modifyPwd.confirmNewPassword" required maxlength="32"
                                ui-validate=" '$value == newPassword' " ui-validate-watch="'newPassword'" ng-minlength="6">
                        </div>
                        <div style="color:red" ng-show="modifyPwd.newPassword != modifyPwd.confirmNewPassword">
                            <p style="margin: 0px;">- 两次输入的密码不同。</p>
                        </div>
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                        <button type="button" class="btn btn-primary" ng-click="modifyPwd()" ng-disabled="mySettingsForm.$invalid">保存</button>
                    </div>
                </div>
                <!-- /.modal-content -->
            </div>
            <!-- /.modal-dialog -->
        </div>
    </form>
    <!-- 修改密码 END -->

    <!-- 修改头像 -->
    <div class="modal fade" id="ChangePortraits" tabindex="-1" role="dialog" aria-labelledby="ChangePortraitsLabel" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                    <h4 class="modal-title" id="ChangePortraitsLabel">修改头像</h4>
                </div>
                <div class="modal-body">
                    <div class="form-group" ng-if="uploader" >
                        <input type="file" nv-file-select uploader="uploader" multiple />
                        <span class="help-block m-b-none">只能选择1mb内的JPG/JPEG/PNG图片。</span>
                        </div>
                        <img id="ProfilePictureResize" src="" ng-show="personImg" />
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                        <button type="button" class="btn btn-primary" ng-click="savePicture()">保存</button>
                    </div>
                </div>
                <!-- /.modal-content -->
            </div>
            <!-- /.modal-dialog -->
        </div>
        <!-- 修改头像 END -->

        <!-- 账号配置 -->
        <div class="modal fade" id="AccountSettings" tabindex="-1" role="dialog" aria-labelledby="AccountSettingsLabel" aria-hidden="true">
            <div class="modal-dialog">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                        <h4 class="modal-title" id="AccountSettingsLabel">账户设置：
                            <b>{{user.userName}}</b>
                        </h4>
                    </div>
                    <div class="modal-body">
                        <div class="form-group form-md-line-input form-md-floating-label no-hint">
                            <label>姓名：</label>
                            <input class="form-control" type="text" name="Name" ng-model="user.name" required maxlength="">
                        </div>
                        <div class="form-group form-md-line-input form-md-floating-label no-hint">
                            <label>邮箱地址：</label>
                            <input type="email" name="EmailAddress" class="form-control" ng-model="user.emailAddress" required maxlength="">
                        </div>
                        <div class="form-group form-md-line-input form-md-floating-label">
                            <label>用户名：</label>
                            <input type="text" ng-disabled="!canChangeUserName" name="UserName" class="form-control" ng-model="user.userName" required
                                maxlength="">
                            <span class="help-block" ng-show="!canChangeUserName">管理用户，不能修改用户名。</span>
                        </div>
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                        <button type="button" class="btn btn-primary" ng-click="saveAccount()">保存</button>
                    </div>
                </div>
                <!-- /.modal-content -->
            </div>
            <!-- /.modal-dialog -->
        </div>
        <!-- 账号配置 END -->

        <!-- 登录日志 -->
        <div class="modal fade" id="LoginLog" tabindex="-1" role="dialog" aria-labelledby="LoginLogLabel" aria-hidden="true">
            <div class="modal-dialog">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                        <h4 class="modal-title" id="LoginLogLabel">登录日志</h4>
                    </div>
                    <div class="modal-body">
                        <div class="alert" ng-repeat="loginAttempt in loginAttempts">
                            <div class="row">
                                <div class="col-xs-3 text-center">
                                    <img class="img-circle" width="50" height="50" src="static/images/default-profile-picture.jpg">
                                    <!-- <img class="img-circle" width="50" height="50" ng-src="{{}}"> -->
                                    <br>
                                    <span class="label ng-binding label-success" ng-if="loginAttempt.result == 'Success'">成功 </span>
                                    <span class="label ng-binding label-danger" ng-if="loginAttempt.result != 'Success'">失败 </span>
                                </div>
                                <div class="col-xs-9">
                                    <div class="row ng-scope" ng-if="loginAttempt.clientIpAddress">
                                        <label class="control-label col-sm-3 text-right">IP地址</label>
                                        <div class="col-sm-9">
                                            <p class="form-control-static ng-binding">
                                                {{loginAttempt.clientIpAddress}}
                                            </p>
                                        </div>
                                    </div>
                                    <div class="row ng-scope" ng-if="loginAttempt.browserInfo">
                                        <label class="control-label col-sm-3 text-right">浏览器</label>
                                        <div class="col-sm-9">
                                            <p class="form-control-static ng-binding">
                                                {{loginAttempt.browserInfo}}
                                            </p>
                                        </div>
                                    </div>
                                    <div class="row ng-scope" ng-if="loginAttempt.creationTime">
                                        <label class="control-label col-sm-3 text-right">时间</label>
                                        <div class="col-sm-9">
                                            <p class="form-control-static ng-binding">
                                                {{loginAttempt.creationTime| date:"yyyy-MM-dd HH:mm:ss"}}
                                            </p>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>

                    <div class="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                    </div>
                </div>
                <!-- /.modal-content -->
            </div>
            <!-- /.modal-dialog -->
        </div>
        <!-- 登录日志 END -->

</div>